# Maintainer: Anatol Pomozov

pkgname=aws-c-common
pkgver=0.8.17
pkgrel=1
pkgdesc='Core c99 package for AWS SDK for C. Includes cross-platform primitives, configuration, data structures, and error handling.'
arch=(loong64 x86_64)
url='https://github.com/awslabs/aws-c-common'
license=(Apache)
depends=(glibc)
makedepends=(cmake)
source=(aws-c-common-$pkgver.zip::https://github.com/awslabs/aws-c-common/archive/v$pkgver.zip)
sha256sums=('85fb290789068fc58ab067b4db2db46b81a46ea5311f6bced9dd539b9ea94582')

build() {
  cd aws-c-common-$pkgver

  cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=ON -S . -B build
  cmake --build build
}

check() {
  cd aws-c-common-$pkgver
  cmake --build build --target test
}

package() {
  cd aws-c-common-$pkgver

  cmake --build build --target install -- DESTDIR="$pkgdir/"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
